package com.zjsd.sqeybusiness.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.zjsd.sqeybusiness.domain.Hydjinfo;
import com.zjsd.sqeybusiness.service.IHydjinfoService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 会员等级Controller
 *
 * @author Zheng
 * @date 2025-03-06
 */
@RestController
@RequestMapping("/sqeybusiness/hydjinfo")
public class HydjinfoController extends BaseController
{
    @Autowired
    private IHydjinfoService hydjinfoService;

    /**
     * 查询会员等级列表
     */
    @PreAuthorize("@ss.hasPermi('sqeybusiness:hydjinfo:list')")
    @GetMapping("/list")
    public TableDataInfo list(Hydjinfo hydjinfo)
    {
        startPage();
        List<Hydjinfo> list = hydjinfoService.selectHydjinfoList(hydjinfo);
        return getDataTable(list);
    }

    /**
     * 导出会员等级列表
     */
    @PreAuthorize("@ss.hasPermi('sqeybusiness:hydjinfo:export')")
    //@Log(title = "会员等级", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(Hydjinfo hydjinfo)
    {
        List<Hydjinfo> list = hydjinfoService.selectHydjinfoList(hydjinfo);
        ExcelUtil<Hydjinfo> util = new ExcelUtil<Hydjinfo>(Hydjinfo.class);
        return util.exportExcel(list, "hydjinfo");
    }

    /**
     * 获取会员等级详细信息
     */
    @PreAuthorize("@ss.hasPermi('sqeybusiness:hydjinfo:query')")
    @GetMapping(value = "/{hydjid}")
    public AjaxResult getInfo(@PathVariable("hydjid") Long hydjid)
    {
        return AjaxResult.success(hydjinfoService.selectHydjinfoById(hydjid));
    }

    /**
     * 新增会员等级
     */
    @PreAuthorize("@ss.hasPermi('sqeybusiness:hydjinfo:add')")
    //@Log(title = "会员等级", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Hydjinfo hydjinfo)
    {
        return toAjax(hydjinfoService.insertHydjinfo(hydjinfo));
    }

    /**
     * 修改会员等级
     */
    @PreAuthorize("@ss.hasPermi('sqeybusiness:hydjinfo:edit')")
    //@Log(title = "会员等级", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Hydjinfo hydjinfo)
    {
        return toAjax(hydjinfoService.updateHydjinfo(hydjinfo));
    }

    /**
     * 删除会员等级
     */
    @PreAuthorize("@ss.hasPermi('sqeybusiness:hydjinfo:remove')")
    //@Log(title = "会员等级", businessType = BusinessType.DELETE)
	@DeleteMapping("/{hydjids}")
    public AjaxResult remove(@PathVariable Long[] hydjids)
    {
        return toAjax(hydjinfoService.deleteHydjinfoByIds(hydjids));
    }
}
